﻿namespace NMortgage.UI.Tests
{
    using System;

    using FluentValidation.TestHelper;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using NMortgage.UI.Model;

    [TestClass]
    public class FixedRateValidatorTest
    {
        #region Properties

        private FixedRateValidator Subject
        {
            get; set;
        }

        #endregion Properties

        #region Methods

        [TestMethod]
        public void FixedRateValidatorConstructorTest()
        {
            FixedRateValidator target = new FixedRateValidator();
            Assert.IsNotNull(target);
        }

        [TestMethod]
        public void Should_have_error_rate_greater_than_30()
        {
            Subject.ShouldHaveValidationErrorFor(fixedRate => fixedRate.Rate, 31d);
        }

        [TestMethod]
        public void Should_have_error_rate_is_0_or_less()
        {
            Subject.ShouldHaveValidationErrorFor(fixedRate => fixedRate.Rate, 0);
            Subject.ShouldHaveValidationErrorFor(fixedRate => fixedRate.Rate, -1d);
        }

        [TestMethod]
        public void Should_not_have_error_for_1()
        {
            Subject.ShouldNotHaveValidationErrorFor(fixedRate => fixedRate.Rate, 1d);
        }

        [TestMethod]
        public void Should_not_have_error_for_30()
        {
            Subject.ShouldNotHaveValidationErrorFor(fixedRate => fixedRate.Rate, 30d);
        }

        [TestInitialize]
        public void TestInitialize()
        {
            Subject = new FixedRateValidator();
        }

        #endregion Methods
    }
}